package com.wjj.system.mapper;

import com.mybatisflex.core.BaseMapper;
import com.mybatisflex.core.query.QueryWrapper;
import com.wjj.common.core.utils.MapstructUtils;
import com.wjj.system.domain.SysDictData;
import com.wjj.system.domain.vo.SysDictDataVo;

import java.util.List;


/**
 * 字典表 数据层
 *
 * @author Lion Li
 */
public interface SysDictDataMapper extends BaseMapper<SysDictData> {

    default List<SysDictDataVo> selectDictDataByType(String dictType) {
        QueryWrapper qw = QueryWrapper.create()
            .eq(SysDictData::getDictType, dictType)
            .orderBy(SysDictData::getDictSort, true);
        List<SysDictData> sysDictData = selectListByQuery(qw);
        return MapstructUtils.convert(sysDictData, SysDictDataVo.class);
    }

}
